***Replication Code for Case-Level Analyses (Table 1, Figure 2, Table A.3)

*Table 1
*1993-2008 decided within 4 years
	* with decision date:
logit any_mention_trunc i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD") & decisionType!=2 & decisionType!=4
fitstat
test 2.uncon3-3.uncon3=0
*1979-2008
logit any_mention i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
fitstat
test 2.uncon3-3.uncon3=0
*1955-2008
logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
fitstat
test 2.uncon3-3.uncon3=0

* Predicted Probabilities referenced in text and Figure 2
* fed declaration of unconstitutionality vs. no declaration *
margins, at(uncon3=(1(1)3) majVotes=6 numOp=4 salienceest=1.02 decisionDirection=2 precedentAlteration=0  economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
marginsplot, recast(scatter)
margins, dydx(uncon3) at(majVotes=6 numOp=4 salienceest=1.02 decisionDirection=2 precedentAlteration=0  economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
* test difference between case that rules federal law unconstitutional and one that rules state law unconstitutional
logit any_mention i.b3.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
margins, dydx(uncon3) at(majVotes=6 numOp=4 salienceest=1.02 decisionDirection=2 precedentAlteration=0  economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)

* media salience *
sum salienceest, detail
logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
*5th to 95th percentile of media salience*
margins, at(uncon3=1 majVotes=6 numOp=4 salienceest=(-0.92(0.1)1.36) decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
marginsplot, recast(line) recastci(rarea) xlabel(-1(0.25)1.25) ylabel(0(0.1)0.3)
*Marginal effect of media salience*
margins, dydx(salienceest) at(uncon3=1 majVotes=6 numOp=4 decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
*25th to 75th percentile of media salience*
margins, at(uncon3=1 majVotes=6 numOp=4 salienceest=(-0.56(0.1)0.43) decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
*95th and 99th percentile*
margins, at(uncon3=1 majVotes=6 numOp=4 salienceest=(1.36) decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)
margins, at(uncon3=1 majVotes=6 numOp=4 salienceest=(2.1) decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)

* number of opinions *
logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
margins, at(uncon3=1 majVotes=6 numOp=(1(1)4) salienceest=1.02 decisionDirection=2 precedentAlteration=0  economic_cases=0 civil_liberties=1 decade1950s=0 decade1960s=0 decade1970s=0 decade1980s=0 decade1990s=1)

* by decade *
logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties i.decadecount if decisionType!=2 & decisionType!=4
margins, at(uncon3=1 majVotes=6 numOp=4 salienceest=1.02 decisionDirection=1 precedentAlteration=0 economic_cases=0 civil_liberties=1 decadecount=(1(1)6))


*Descrptives for mentioned cases
sum majVotes if any_mention==1, detail
sum numOp if any_mention==1, detail
sum salienceest if any_mention==1, detail
tab decisionDirection if any_mention==1, nolabel
tab precedentAlteration if any_mention==1, nolabel
tab economic_cases if any_mention==1, nolabel
tab civil_liberties if any_mention==1, nolabel
tab decadecount if any_mention==1

*Number of Legal Provisions as Measure of Case Complexity
*1993-2008 decided within 4 years
logit any_mention_trunc i.uncon3 majVotes numLegalProvisions salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD") & decisionType!=2 & decisionType!=4
*1979-2008
logit any_mention i.uncon3 majVotes numLegalProvisions salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
*1955-2008
logit any_mention i.uncon3 majVotes numLegalProvisions salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4

*Issue area dummies
logit any_mention_trunc i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration i.issueArea decade1950s decade1960s decade1970s decade1980s decade1990s if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD") & decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0
*1979-2008
logit any_mention i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration i.issueArea  decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0
*1955-2008
logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration i.issueArea  decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0

*Firth Logits
logit any_mention_trunc i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1990s if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD") & decisionType!=2 & decisionType!=4
est stor mod1 
firthlogit any_mention_trunc i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1990s if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD") & decisionType!=2 & decisionType!=4
est stor mod2
esttab mod1 mod2

logit any_mention i.uncon3 majVotes numLegalProvisions salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
est stor mod3
firthlogit any_mention i.uncon3 majVotes numLegalProvisions salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
est stor mod4
esttab mod3 mod4

logit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties  decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
est stor mod5
firthlogit any_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
est stor mod6
esttab mod5 mod6

*Count Models
gen all_mention=dem_mention+GOP_mention
replace all_mention=0 if all_mention==.
gen all_mention_trunc=dem_mention_trunc+GOP_mention_trunc
replace all_mention_trunc=0 if all_mention_trunc==.

* add these indicators for the timeframe *
gen years1993_2008 = .
replace years1993_2008 = 1 if dateDecision > date("19921231","YMD") & dateDecision < date("20090101","YMD")
replace years1993_2008 = 0 if dateDecision <= date("19921231","YMD") 
replace years1993_2008 = 0 if dateDecision >= date("20090101","YMD")

*1993-2008
nbreg all_mention_trunc i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if years1993_2008==1 & decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0
*1979-2008
nbreg all_mention i.uncon3 majVotes numOp salienceest wordLog_zscore i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0
*1955-2008
nbreg all_mention i.uncon3 majVotes numOp salienceest i.decisionDirection precedentAlteration economic_cases civil_liberties decade1950s decade1960s decade1970s decade1980s decade1990s if decisionType!=2 & decisionType!=4
test 2.uncon3-3.uncon3=0

